.class public Lrexsee/network/RexseeInstantAudio;
.super Ljava/lang/Object;
.source "RexseeInstantAudio.java"

# interfaces
.implements Lrexsee/core/browser/clazz/JavascriptInterface;


# static fields
.field private static final INTERFACE_NAME:Ljava/lang/String; = "InstantAudio"


# instance fields
.field private final mAudioFormat:I

.field private mAudioRecord:Landroid/media/AudioRecord;

.field private mAudioTrack:Landroid/media/AudioTrack;

.field private final mAuidoSource:I

.field private final mBrowser:Lrexsee/core/browser/Browser;

.field private final mBufferSizeEachTime:I

.field private final mChannelConfig:I

.field private mClient:Lrexsee/network/SocketClient;

.field private mClientAllowPlayback:Z

.field private mClientAllowRecord:Z

.field private mClientHandler:Landroid/os/Handler;

.field private final mClientId:Ljava/lang/String;

.field private final mClientPort:I

.field private final mConnectTimeout:I

.field private final mPalybackBufferSizeInByte:I

.field private final mReadingCycle:I

.field private final mRecordBufferSizeInByte:I

.field private mRecordThread:Ljava/lang/Thread;

.field private final mRecordingCycle:I

.field private final mSampleRateInHz:I

.field private mServer:Lrexsee/network/SocketServer;

.field private mServerAllowPlayback:Z

.field private mServerAllowRecord:Z

.field private mServerHandler:Landroid/os/Handler;

.field private final mServerId:Ljava/lang/String;

.field private final mServerPort:I

.field private final mStreamType:I

.field private final onConnected:Lrexsee/network/SocketAbstractClass$SocketConnectedListener;

.field private final onFailed:Lrexsee/network/SocketAbstractClass$SocketFailedListener;

.field private final onLost:Lrexsee/network/SocketAbstractClass$SocketLostListener;

.field private final onRead:Lrexsee/network/SocketAbstractClass$SocketDataListener;

.field private final onStarted:Lrexsee/network/SocketAbstractClass$SocketStartedListener;

.field private final onWrite:Lrexsee/network/SocketAbstractClass$SocketDataListener;


# direct methods
.method public constructor <init>(Lrexsee/core/browser/Browser;)V
    .locals 6
    .param p1, "browser"    # Lrexsee/core/browser/Browser;

    .prologue
    const/16 v5, 0x14

    const/4 v4, 0x2

    const/4 v3, 0x0

    const/4 v2, 0x1

    const/4 v1, 0x0

    .line 183
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 39
    new-instance v0, Lrexsee/network/RexseeInstantAudio$1;

    invoke-direct {v0, p0}, Lrexsee/network/RexseeInstantAudio$1;-><init>(Lrexsee/network/RexseeInstantAudio;)V

    iput-object v0, p0, Lrexsee/network/RexseeInstantAudio;->onStarted:Lrexsee/network/SocketAbstractClass$SocketStartedListener;

    .line 45
    new-instance v0, Lrexsee/network/RexseeInstantAudio$2;

    invoke-direct {v0, p0}, Lrexsee/network/RexseeInstantAudio$2;-><init>(Lrexsee/network/RexseeInstantAudio;)V

    iput-object v0, p0, Lrexsee/network/RexseeInstantAudio;->onFailed:Lrexsee/network/SocketAbstractClass$SocketFailedListener;

    .line 52
    new-instance v0, Lrexsee/network/RexseeInstantAudio$3;

    invoke-direct {v0, p0}, Lrexsee/network/RexseeInstantAudio$3;-><init>(Lrexsee/network/RexseeInstantAudio;)V

    iput-object v0, p0, Lrexsee/network/RexseeInstantAudio;->onConnected:Lrexsee/network/SocketAbstractClass$SocketConnectedListener;

    .line 133
    new-instance v0, Lrexsee/network/RexseeInstantAudio$4;

    invoke-direct {v0, p0}, Lrexsee/network/RexseeInstantAudio$4;-><init>(Lrexsee/network/RexseeInstantAudio;)V

    iput-object v0, p0, Lrexsee/network/RexseeInstantAudio;->onLost:Lrexsee/network/SocketAbstractClass$SocketLostListener;

    .line 140
    new-instance v0, Lrexsee/network/RexseeInstantAudio$5;

    invoke-direct {v0, p0}, Lrexsee/network/RexseeInstantAudio$5;-><init>(Lrexsee/network/RexseeInstantAudio;)V

    iput-object v0, p0, Lrexsee/network/RexseeInstantAudio;->onRead:Lrexsee/network/SocketAbstractClass$SocketDataListener;

    .line 150
    iput-object v1, p0, Lrexsee/network/RexseeInstantAudio;->onWrite:Lrexsee/network/SocketAbstractClass$SocketDataListener;

    .line 152
    const-string v0, "InstantAudioServer"

    iput-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mServerId:Ljava/lang/String;

    .line 153
    iput-object v1, p0, Lrexsee/network/RexseeInstantAudio;->mServerHandler:Landroid/os/Handler;

    .line 154
    const-string v0, "InstantAudioClient"

    iput-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mClientId:Ljava/lang/String;

    .line 155
    iput-object v1, p0, Lrexsee/network/RexseeInstantAudio;->mClientHandler:Landroid/os/Handler;

    .line 156
    const/16 v0, 0x1f91

    iput v0, p0, Lrexsee/network/RexseeInstantAudio;->mServerPort:I

    .line 157
    const/16 v0, 0x1f92

    iput v0, p0, Lrexsee/network/RexseeInstantAudio;->mClientPort:I

    .line 158
    const/16 v0, 0x2710

    iput v0, p0, Lrexsee/network/RexseeInstantAudio;->mConnectTimeout:I

    .line 159
    iput v5, p0, Lrexsee/network/RexseeInstantAudio;->mRecordingCycle:I

    .line 160
    iput v5, p0, Lrexsee/network/RexseeInstantAudio;->mReadingCycle:I

    .line 162
    iput v2, p0, Lrexsee/network/RexseeInstantAudio;->mAuidoSource:I

    .line 163
    const/16 v0, 0x5622

    iput v0, p0, Lrexsee/network/RexseeInstantAudio;->mSampleRateInHz:I

    .line 164
    iput v4, p0, Lrexsee/network/RexseeInstantAudio;->mChannelConfig:I

    .line 165
    iput v4, p0, Lrexsee/network/RexseeInstantAudio;->mAudioFormat:I

    .line 166
    const/4 v0, 0x3

    iput v0, p0, Lrexsee/network/RexseeInstantAudio;->mStreamType:I

    .line 173
    iput-object v1, p0, Lrexsee/network/RexseeInstantAudio;->mServer:Lrexsee/network/SocketServer;

    .line 174
    iput-boolean v2, p0, Lrexsee/network/RexseeInstantAudio;->mServerAllowRecord:Z

    .line 175
    iput-boolean v3, p0, Lrexsee/network/RexseeInstantAudio;->mServerAllowPlayback:Z

    .line 176
    iput-object v1, p0, Lrexsee/network/RexseeInstantAudio;->mClient:Lrexsee/network/SocketClient;

    .line 177
    iput-boolean v2, p0, Lrexsee/network/RexseeInstantAudio;->mClientAllowRecord:Z

    .line 178
    iput-boolean v3, p0, Lrexsee/network/RexseeInstantAudio;->mClientAllowPlayback:Z

    .line 179
    iput-object v1, p0, Lrexsee/network/RexseeInstantAudio;->mRecordThread:Ljava/lang/Thread;

    .line 180
    iput-object v1, p0, Lrexsee/network/RexseeInstantAudio;->mAudioRecord:Landroid/media/AudioRecord;

    .line 181
    iput-object v1, p0, Lrexsee/network/RexseeInstantAudio;->mAudioTrack:Landroid/media/AudioTrack;

    .line 184
    iput-object p1, p0, Lrexsee/network/RexseeInstantAudio;->mBrowser:Lrexsee/core/browser/Browser;

    .line 185
    invoke-virtual {p0}, Lrexsee/network/RexseeInstantAudio;->getRecordMinBufferSize()I

    move-result v0

    iput v0, p0, Lrexsee/network/RexseeInstantAudio;->mBufferSizeEachTime:I

    iput v0, p0, Lrexsee/network/RexseeInstantAudio;->mRecordBufferSizeInByte:I

    .line 186
    invoke-virtual {p0}, Lrexsee/network/RexseeInstantAudio;->getPalybackMinBufferSize()I

    move-result v0

    iput v0, p0, Lrexsee/network/RexseeInstantAudio;->mPalybackBufferSizeInByte:I

    .line 187
    return-void
.end method

.method static synthetic access$0(Lrexsee/network/RexseeInstantAudio;)Lrexsee/core/browser/Browser;
    .locals 1

    .prologue
    .line 172
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mBrowser:Lrexsee/core/browser/Browser;

    return-object v0
.end method

.method static synthetic access$1(Lrexsee/network/RexseeInstantAudio;)Lrexsee/network/SocketServer;
    .locals 1

    .prologue
    .line 173
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mServer:Lrexsee/network/SocketServer;

    return-object v0
.end method

.method static synthetic access$10(Lrexsee/network/RexseeInstantAudio;)Landroid/os/Handler;
    .locals 1

    .prologue
    .line 153
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mServerHandler:Landroid/os/Handler;

    return-object v0
.end method

.method static synthetic access$11(Lrexsee/network/RexseeInstantAudio;)Landroid/os/Handler;
    .locals 1

    .prologue
    .line 155
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mClientHandler:Landroid/os/Handler;

    return-object v0
.end method

.method static synthetic access$12(Lrexsee/network/RexseeInstantAudio;)I
    .locals 1

    .prologue
    .line 170
    iget v0, p0, Lrexsee/network/RexseeInstantAudio;->mBufferSizeEachTime:I

    return v0
.end method

.method static synthetic access$13(Lrexsee/network/RexseeInstantAudio;Ljava/lang/Thread;)V
    .locals 0

    .prologue
    .line 179
    iput-object p1, p0, Lrexsee/network/RexseeInstantAudio;->mRecordThread:Ljava/lang/Thread;

    return-void
.end method

.method static synthetic access$14(Lrexsee/network/RexseeInstantAudio;)Ljava/lang/Thread;
    .locals 1

    .prologue
    .line 179
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mRecordThread:Ljava/lang/Thread;

    return-object v0
.end method

.method static synthetic access$15(Lrexsee/network/RexseeInstantAudio;)Landroid/media/AudioTrack;
    .locals 1

    .prologue
    .line 181
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mAudioTrack:Landroid/media/AudioTrack;

    return-object v0
.end method

.method static synthetic access$16(Lrexsee/network/RexseeInstantAudio;Landroid/media/AudioTrack;)V
    .locals 0

    .prologue
    .line 181
    iput-object p1, p0, Lrexsee/network/RexseeInstantAudio;->mAudioTrack:Landroid/media/AudioTrack;

    return-void
.end method

.method static synthetic access$17(Lrexsee/network/RexseeInstantAudio;)I
    .locals 1

    .prologue
    .line 169
    iget v0, p0, Lrexsee/network/RexseeInstantAudio;->mPalybackBufferSizeInByte:I

    return v0
.end method

.method static synthetic access$2(Lrexsee/network/RexseeInstantAudio;)Lrexsee/network/SocketClient;
    .locals 1

    .prologue
    .line 176
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mClient:Lrexsee/network/SocketClient;

    return-object v0
.end method

.method static synthetic access$3(Lrexsee/network/RexseeInstantAudio;)Z
    .locals 1

    .prologue
    .line 174
    iget-boolean v0, p0, Lrexsee/network/RexseeInstantAudio;->mServerAllowRecord:Z

    return v0
.end method

.method static synthetic access$4(Lrexsee/network/RexseeInstantAudio;)Z
    .locals 1

    .prologue
    .line 177
    iget-boolean v0, p0, Lrexsee/network/RexseeInstantAudio;->mClientAllowRecord:Z

    return v0
.end method

.method static synthetic access$5(Lrexsee/network/RexseeInstantAudio;)Z
    .locals 1

    .prologue
    .line 175
    iget-boolean v0, p0, Lrexsee/network/RexseeInstantAudio;->mServerAllowPlayback:Z

    return v0
.end method

.method static synthetic access$6(Lrexsee/network/RexseeInstantAudio;)Z
    .locals 1

    .prologue
    .line 178
    iget-boolean v0, p0, Lrexsee/network/RexseeInstantAudio;->mClientAllowPlayback:Z

    return v0
.end method

.method static synthetic access$7(Lrexsee/network/RexseeInstantAudio;)Landroid/media/AudioRecord;
    .locals 1

    .prologue
    .line 180
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mAudioRecord:Landroid/media/AudioRecord;

    return-object v0
.end method

.method static synthetic access$8(Lrexsee/network/RexseeInstantAudio;Landroid/media/AudioRecord;)V
    .locals 0

    .prologue
    .line 180
    iput-object p1, p0, Lrexsee/network/RexseeInstantAudio;->mAudioRecord:Landroid/media/AudioRecord;

    return-void
.end method

.method static synthetic access$9(Lrexsee/network/RexseeInstantAudio;)I
    .locals 1

    .prologue
    .line 168
    iget v0, p0, Lrexsee/network/RexseeInstantAudio;->mRecordBufferSizeInByte:I

    return v0
.end method


# virtual methods
.method public getInheritInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 0
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 32
    return-object p0
.end method

.method public getInterfaceName()Ljava/lang/String;
    .locals 2

    .prologue
    .line 28
    new-instance v0, Ljava/lang/StringBuilder;

    iget-object v1, p0, Lrexsee/network/RexseeInstantAudio;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v1, v1, Lrexsee/core/browser/Browser;->application:Lrexsee/core/application/RexseeApplication;

    iget-object v1, v1, Lrexsee/core/application/RexseeApplication;->resources:Lrexsee/core/application/Resource;

    iget-object v1, v1, Lrexsee/core/application/Resource;->prefix:Ljava/lang/String;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v1, "InstantAudio"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getNewInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 1
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 36
    new-instance v0, Lrexsee/network/RexseeSocket;

    invoke-direct {v0, p1}, Lrexsee/network/RexseeSocket;-><init>(Lrexsee/core/browser/Browser;)V

    return-object v0
.end method

.method public getPalybackMinBufferSize()I
    .locals 2

    .prologue
    const/4 v1, 0x2

    .line 195
    const/16 v0, 0x5622

    invoke-static {v0, v1, v1}, Landroid/media/AudioTrack;->getMinBufferSize(III)I

    move-result v0

    return v0
.end method

.method public getRecordMinBufferSize()I
    .locals 2

    .prologue
    const/4 v1, 0x2

    .line 192
    const/16 v0, 0x5622

    invoke-static {v0, v1, v1}, Landroid/media/AudioRecord;->getMinBufferSize(III)I

    move-result v0

    return v0
.end method

.method public startClient(Ljava/lang/String;ZZ)Z
    .locals 15
    .param p1, "remoteIp"    # Ljava/lang/String;
    .param p2, "allowRecord"    # Z
    .param p3, "allowPlayback"    # Z

    .prologue
    .line 223
    move/from16 v0, p2

    move-object v1, p0

    iput-boolean v0, v1, Lrexsee/network/RexseeInstantAudio;->mClientAllowRecord:Z

    .line 224
    move/from16 v0, p3

    move-object v1, p0

    iput-boolean v0, v1, Lrexsee/network/RexseeInstantAudio;->mClientAllowPlayback:Z

    .line 225
    invoke-static {}, Lrexsee/network/RexseeNetwork;->getInetAddress()Ljava/net/InetAddress;

    move-result-object v13

    .line 226
    .local v13, "addr":Ljava/net/InetAddress;
    if-nez v13, :cond_1

    .line 227
    iget-object v2, p0, Lrexsee/network/RexseeInstantAudio;->mBrowser:Lrexsee/core/browser/Browser;

    if-eqz v2, :cond_0

    iget-object v2, p0, Lrexsee/network/RexseeInstantAudio;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/network/RexseeInstantAudio;->getInterfaceName()Ljava/lang/String;

    move-result-object v3

    const-string v4, "Local address is not available."

    invoke-virtual {v2, v3, v4}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    .line 228
    :cond_0
    const/4 v2, 0x0

    .line 250
    :goto_0
    return v2

    .line 230
    :cond_1
    new-instance v4, Ljava/net/InetSocketAddress;

    const/16 v2, 0x1f92

    invoke-direct {v4, v13, v2}, Ljava/net/InetSocketAddress;-><init>(Ljava/net/InetAddress;I)V

    .line 233
    .local v4, "localAddress":Ljava/net/InetSocketAddress;
    :try_start_0
    new-instance v5, Ljava/net/InetSocketAddress;

    invoke-static/range {p1 .. p1}, Ljava/net/InetAddress;->getByName(Ljava/lang/String;)Ljava/net/InetAddress;

    move-result-object v2

    const/16 v3, 0x1f91

    invoke-direct {v5, v2, v3}, Ljava/net/InetSocketAddress;-><init>(Ljava/net/InetAddress;I)V
    :try_end_0
    .catch Ljava/net/UnknownHostException; {:try_start_0 .. :try_end_0} :catch_0

    .line 239
    .local v5, "remoteAddress":Ljava/net/InetSocketAddress;
    :try_start_1
    iget-object v2, p0, Lrexsee/network/RexseeInstantAudio;->mClient:Lrexsee/network/SocketClient;

    if-eqz v2, :cond_2

    .line 240
    iget-object v2, p0, Lrexsee/network/RexseeInstantAudio;->mClient:Lrexsee/network/SocketClient;

    invoke-virtual {v2}, Lrexsee/network/SocketClient;->close()V

    .line 241
    const/4 v2, 0x0

    iput-object v2, p0, Lrexsee/network/RexseeInstantAudio;->mClient:Lrexsee/network/SocketClient;

    .line 243
    :cond_2
    new-instance v2, Lrexsee/network/SocketClient;

    const-string v3, "InstantAudioClient"

    const/16 v6, 0x2710

    const/16 v7, 0x14

    invoke-direct/range {v2 .. v7}, Lrexsee/network/SocketClient;-><init>(Ljava/lang/String;Ljava/net/InetSocketAddress;Ljava/net/InetSocketAddress;II)V

    iput-object v2, p0, Lrexsee/network/RexseeInstantAudio;->mClient:Lrexsee/network/SocketClient;

    .line 244
    iget-object v6, p0, Lrexsee/network/RexseeInstantAudio;->mClient:Lrexsee/network/SocketClient;

    iget-object v7, p0, Lrexsee/network/RexseeInstantAudio;->onStarted:Lrexsee/network/SocketAbstractClass$SocketStartedListener;

    iget-object v8, p0, Lrexsee/network/RexseeInstantAudio;->onFailed:Lrexsee/network/SocketAbstractClass$SocketFailedListener;

    iget-object v9, p0, Lrexsee/network/RexseeInstantAudio;->onConnected:Lrexsee/network/SocketAbstractClass$SocketConnectedListener;

    iget-object v10, p0, Lrexsee/network/RexseeInstantAudio;->onLost:Lrexsee/network/SocketAbstractClass$SocketLostListener;

    iget-object v11, p0, Lrexsee/network/RexseeInstantAudio;->onRead:Lrexsee/network/SocketAbstractClass$SocketDataListener;

    iget-object v12, p0, Lrexsee/network/RexseeInstantAudio;->onWrite:Lrexsee/network/SocketAbstractClass$SocketDataListener;

    invoke-virtual/range {v6 .. v12}, Lrexsee/network/SocketClient;->setListeners(Lrexsee/network/SocketAbstractClass$SocketStartedListener;Lrexsee/network/SocketAbstractClass$SocketFailedListener;Lrexsee/network/SocketAbstractClass$SocketConnectedListener;Lrexsee/network/SocketAbstractClass$SocketLostListener;Lrexsee/network/SocketAbstractClass$SocketDataListener;Lrexsee/network/SocketAbstractClass$SocketDataListener;)V

    .line 245
    new-instance v2, Landroid/os/Handler;

    invoke-direct {v2}, Landroid/os/Handler;-><init>()V

    iput-object v2, p0, Lrexsee/network/RexseeInstantAudio;->mClientHandler:Landroid/os/Handler;

    .line 246
    iget-object v2, p0, Lrexsee/network/RexseeInstantAudio;->mClient:Lrexsee/network/SocketClient;

    invoke-virtual {v2}, Lrexsee/network/SocketClient;->start()V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1

    .line 247
    const/4 v2, 0x1

    goto :goto_0

    .line 234
    .end local v5    # "remoteAddress":Ljava/net/InetSocketAddress;
    :catch_0
    move-exception v2

    move-object v14, v2

    .line 235
    .local v14, "e":Ljava/net/UnknownHostException;
    iget-object v2, p0, Lrexsee/network/RexseeInstantAudio;->mBrowser:Lrexsee/core/browser/Browser;

    if-eqz v2, :cond_3

    iget-object v2, p0, Lrexsee/network/RexseeInstantAudio;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/network/RexseeInstantAudio;->getInterfaceName()Ljava/lang/String;

    move-result-object v3

    const-string v4, "Remote address is not available."

    .end local v4    # "localAddress":Ljava/net/InetSocketAddress;
    invoke-virtual {v2, v3, v4}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    .line 236
    :cond_3
    const/4 v2, 0x0

    goto :goto_0

    .line 248
    .end local v14    # "e":Ljava/net/UnknownHostException;
    .restart local v4    # "localAddress":Ljava/net/InetSocketAddress;
    .restart local v5    # "remoteAddress":Ljava/net/InetSocketAddress;
    :catch_1
    move-exception v2

    move-object v14, v2

    .line 249
    .local v14, "e":Ljava/lang/Exception;
    iget-object v2, p0, Lrexsee/network/RexseeInstantAudio;->mBrowser:Lrexsee/core/browser/Browser;

    if-eqz v2, :cond_4

    iget-object v2, p0, Lrexsee/network/RexseeInstantAudio;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/network/RexseeInstantAudio;->getInterfaceName()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3, v14}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/Exception;)V

    .line 250
    :cond_4
    const/4 v2, 0x0

    goto :goto_0
.end method

.method public startServer(ZZ)Z
    .locals 12
    .param p1, "allowRecord"    # Z
    .param p2, "allowPlayback"    # Z

    .prologue
    .line 199
    iput-boolean p1, p0, Lrexsee/network/RexseeInstantAudio;->mServerAllowRecord:Z

    .line 200
    iput-boolean p2, p0, Lrexsee/network/RexseeInstantAudio;->mServerAllowPlayback:Z

    .line 201
    invoke-static {}, Lrexsee/network/RexseeNetwork;->getInetAddress()Ljava/net/InetAddress;

    move-result-object v10

    .line 202
    .local v10, "addr":Ljava/net/InetAddress;
    if-nez v10, :cond_1

    .line 203
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mBrowser:Lrexsee/core/browser/Browser;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/network/RexseeInstantAudio;->getInterfaceName()Ljava/lang/String;

    move-result-object v1

    const-string v2, "Local address is not available."

    invoke-virtual {v0, v1, v2}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    .line 204
    :cond_0
    const/4 v0, 0x0

    .line 219
    :goto_0
    return v0

    .line 206
    :cond_1
    new-instance v2, Ljava/net/InetSocketAddress;

    const/16 v0, 0x1f91

    invoke-direct {v2, v10, v0}, Ljava/net/InetSocketAddress;-><init>(Ljava/net/InetAddress;I)V

    .line 208
    .local v2, "localAddress":Ljava/net/InetSocketAddress;
    :try_start_0
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mServer:Lrexsee/network/SocketServer;

    if-eqz v0, :cond_2

    .line 209
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mServer:Lrexsee/network/SocketServer;

    invoke-virtual {v0}, Lrexsee/network/SocketServer;->close()V

    .line 210
    const/4 v0, 0x0

    iput-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mServer:Lrexsee/network/SocketServer;

    .line 212
    :cond_2
    new-instance v0, Lrexsee/network/SocketServer;

    const-string v1, "InstantAudioServer"

    const/4 v3, 0x1

    const/4 v4, -0x1

    const/16 v5, 0x14

    invoke-direct/range {v0 .. v5}, Lrexsee/network/SocketServer;-><init>(Ljava/lang/String;Ljava/net/InetSocketAddress;III)V

    iput-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mServer:Lrexsee/network/SocketServer;

    .line 213
    iget-object v3, p0, Lrexsee/network/RexseeInstantAudio;->mServer:Lrexsee/network/SocketServer;

    iget-object v4, p0, Lrexsee/network/RexseeInstantAudio;->onStarted:Lrexsee/network/SocketAbstractClass$SocketStartedListener;

    iget-object v5, p0, Lrexsee/network/RexseeInstantAudio;->onFailed:Lrexsee/network/SocketAbstractClass$SocketFailedListener;

    iget-object v6, p0, Lrexsee/network/RexseeInstantAudio;->onConnected:Lrexsee/network/SocketAbstractClass$SocketConnectedListener;

    iget-object v7, p0, Lrexsee/network/RexseeInstantAudio;->onLost:Lrexsee/network/SocketAbstractClass$SocketLostListener;

    iget-object v8, p0, Lrexsee/network/RexseeInstantAudio;->onRead:Lrexsee/network/SocketAbstractClass$SocketDataListener;

    iget-object v9, p0, Lrexsee/network/RexseeInstantAudio;->onWrite:Lrexsee/network/SocketAbstractClass$SocketDataListener;

    invoke-virtual/range {v3 .. v9}, Lrexsee/network/SocketServer;->setListeners(Lrexsee/network/SocketAbstractClass$SocketStartedListener;Lrexsee/network/SocketAbstractClass$SocketFailedListener;Lrexsee/network/SocketAbstractClass$SocketConnectedListener;Lrexsee/network/SocketAbstractClass$SocketLostListener;Lrexsee/network/SocketAbstractClass$SocketDataListener;Lrexsee/network/SocketAbstractClass$SocketDataListener;)V

    .line 214
    new-instance v0, Landroid/os/Handler;

    invoke-direct {v0}, Landroid/os/Handler;-><init>()V

    iput-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mServerHandler:Landroid/os/Handler;

    .line 215
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mServer:Lrexsee/network/SocketServer;

    invoke-virtual {v0}, Lrexsee/network/SocketServer;->start()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 216
    const/4 v0, 0x1

    goto :goto_0

    .line 217
    :catch_0
    move-exception v0

    move-object v11, v0

    .line 218
    .local v11, "e":Ljava/lang/Exception;
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mBrowser:Lrexsee/core/browser/Browser;

    if-eqz v0, :cond_3

    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/network/RexseeInstantAudio;->getInterfaceName()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1, v11}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/Exception;)V

    .line 219
    :cond_3
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public stop()V
    .locals 1

    .prologue
    .line 256
    :try_start_0
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mServer:Lrexsee/network/SocketServer;

    if-eqz v0, :cond_0

    .line 257
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mServer:Lrexsee/network/SocketServer;

    invoke-virtual {v0}, Lrexsee/network/SocketServer;->close()V

    .line 258
    const/4 v0, 0x0

    iput-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mServer:Lrexsee/network/SocketServer;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_4

    .line 263
    :cond_0
    :goto_0
    :try_start_1
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mClient:Lrexsee/network/SocketClient;

    if-eqz v0, :cond_1

    .line 264
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mClient:Lrexsee/network/SocketClient;

    invoke-virtual {v0}, Lrexsee/network/SocketClient;->close()V

    .line 265
    const/4 v0, 0x0

    iput-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mClient:Lrexsee/network/SocketClient;
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_3

    .line 270
    :cond_1
    :goto_1
    :try_start_2
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mRecordThread:Ljava/lang/Thread;

    if-eqz v0, :cond_2

    .line 271
    const/4 v0, 0x0

    iput-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mRecordThread:Ljava/lang/Thread;
    :try_end_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_2

    .line 276
    :cond_2
    :goto_2
    :try_start_3
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mAudioRecord:Landroid/media/AudioRecord;

    if-eqz v0, :cond_3

    .line 277
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mAudioRecord:Landroid/media/AudioRecord;

    invoke-virtual {v0}, Landroid/media/AudioRecord;->stop()V

    .line 278
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mAudioRecord:Landroid/media/AudioRecord;

    invoke-virtual {v0}, Landroid/media/AudioRecord;->release()V

    .line 279
    const/4 v0, 0x0

    iput-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mAudioRecord:Landroid/media/AudioRecord;
    :try_end_3
    .catch Ljava/lang/Exception; {:try_start_3 .. :try_end_3} :catch_1

    .line 284
    :cond_3
    :goto_3
    :try_start_4
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mAudioTrack:Landroid/media/AudioTrack;

    if-eqz v0, :cond_4

    .line 285
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mAudioTrack:Landroid/media/AudioTrack;

    invoke-virtual {v0}, Landroid/media/AudioTrack;->stop()V

    .line 286
    iget-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mAudioTrack:Landroid/media/AudioTrack;

    invoke-virtual {v0}, Landroid/media/AudioTrack;->release()V

    .line 287
    const/4 v0, 0x0

    iput-object v0, p0, Lrexsee/network/RexseeInstantAudio;->mAudioTrack:Landroid/media/AudioTrack;
    :try_end_4
    .catch Ljava/lang/Exception; {:try_start_4 .. :try_end_4} :catch_0

    .line 291
    :cond_4
    :goto_4
    return-void

    .line 289
    :catch_0
    move-exception v0

    goto :goto_4

    .line 281
    :catch_1
    move-exception v0

    goto :goto_3

    .line 273
    :catch_2
    move-exception v0

    goto :goto_2

    .line 267
    :catch_3
    move-exception v0

    goto :goto_1

    .line 260
    :catch_4
    move-exception v0

    goto :goto_0
.end method
